<template>
  <el-form-item label="索引" prop="index">
    <el-select :value="value" placeholder="值越小越靠前" @change="inputChange">
      <el-option v-for="item in dataArr" :label="item" :value="item" :key="item" />
    </el-select>
  </el-form-item>
</template>

<script lang="ts">
  import { Vue, Component, Model, Prop } from 'vue-property-decorator'

  @Component({
    name: 'ComEnumTypeSelect',
  })
  export default class CodeInput extends Vue {

    @Model('change', { type: String }) value!: string
    @Prop({ type: Number, default: 10 }) max!: number

    get dataArr() {
      const arr = []
      for (let i = 0; i < this.max; i++) {
        arr.push(`${i}`)
      }
      return arr
    }

    inputChange(text: string) {
      this.$emit('change', text)
    }
  }
</script>

<style scoped>

</style>
